<?	/*
	// File:	sendmail.wcp.phps
	// Purpose:	sendmail user manipulation
	// Author:	Felix <webmaster@can-host.com>
	*/


// Handle user manipulation
if ($type == "user") {
	// Create User :: expect *
	if ($data['action'] == "create") {
		
		// Handle autoreply
		if ($data['autoreply']) {
			$fp = fopen($cfg['basedir']."/autoresponder/".$data['username'],"w+");
			fwrite($fp,$data['autoreply'],10240); // limit autoreply to 10k
			fclose($fp);
		}
		
	}
	
	// Update User :: expect *
	if ($data['action'] == "update") {
		
		// Handle autoreply
		if ($data['autoreply']) {
			$fp = fopen($cfg['basedir']."/autoresponder/".$data['username'],"w+");
			fwrite($fp,$data['autoreply'],10240); // limit autoreply to 10k
			fclose($fp);
		}
		
	}
	
	// Remove User :: expect username
	if ($data['action'] == "remove") {
		
		// Remove autoreply message
		if (file_exists($cfg['basedir']."/autoresponder/".$data['username']))
			unlink($cfg['basedir']."/autoresponder/".$data['username']);
		
	}
}

?>
